﻿using SqlSugar;
using System.Collections.Generic;

namespace GogsWeb.Api
{
    /// <summary>
    /// 查询组件
    /// </summary>
    public class QueryData
    {
        /// <summary>
        /// 页码
        /// </summary>
        public int page { get; set; }

        /// <summary>
        /// 分页大小
        /// </summary>
        public int pageSize { get; set; }

        /// <summary>
        /// 查询条件
        /// </summary>
        public IList<WhereData> where { get; set; }
    }

    /// <summary>
    /// 查询条件模型
    /// </summary>
    public class WhereData
    {
        /// <summary>
        /// 字段名称
        /// </summary>
        public string FieldName { get; set; }
        /// <summary>
        /// 查询值
        /// </summary>
        public string FieldValue { get; set; }
        /// <summary>
        /// 查询类型
        /// </summary>
        public ConditionalType ConditionalType { get; set; }
    }

    /// <summary>
    /// 查询类型
    /// </summary>
    public enum ConditionalType
    {
        /// <summary>
        /// 等于
        /// </summary>
        Equal = 0,
        /// <summary>
        /// 匹配
        /// </summary>
        Like = 1,
        /// <summary>
        /// 大于
        /// </summary>
        GreaterThan = 2,
        /// <summary>
        /// 大于等于
        /// </summary> 
        GreaterThanOrEqual = 3,
        /// <summary>
        /// 小于
        /// </summary>
        LessThan = 4,
        /// <summary>
        /// 小于等于
        /// </summary>
        LessThanOrEqual = 5,
        /// <summary>
        /// 存在
        /// </summary>
        In = 6,
        /// <summary>
        /// 不存在
        /// </summary>
        NotIn = 7,
        /// <summary>
        /// 左匹配
        /// </summary>
        LikeLeft = 8,
        /// <summary>
        /// 右匹配
        /// </summary>
        LikeRight = 9,
        /// <summary>
        /// 不等于
        /// </summary>
        NoEqual = 10,
        /// <summary>
        /// 为空
        /// </summary>
        IsNullOrEmpty = 11,
        /// <summary>
        /// 不存在
        /// </summary>
        IsNot = 12,
        /// <summary>
        /// 不匹配
        /// </summary>
        NoLike = 13,
        /// <summary>
        /// 等于bull
        /// </summary>
        EqualNull = 14
    }
}
